home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
HPAVC
/
HPAVC CD-ROM.iso
/
KMOUSE10.ZIP
/
TESTKMOU.PAS
< prev
Wrap
Pascal/Delphi Source File
|
1989-10-05
|
2KB
|
76 lines
Program testKmou;
{ program to test the operation of the keymouse unit }
Uses DOS,CRT,KMouse;
Const
HelloStr : String =
'**** KEYMOUSE DEMO PROGRAM ****';
ExitStr : String =
'Press the [ESC] key to end the Demo';
Var Ch : Char;
X,Y : Word;
{$F+}
Function ScanKey : Char;
{Reads a key from the keyboard and converts 2 scan codes into 1 char }
{ by adding 128 to the ordinal value }
Var
Ch : Char;
Begin
Ch := ReadKey;
if (Ch = #0) and KeyPressed Then
Begin
Ch := ReadKey;
if Ord(Ch) < 128 Then
Ch := Chr(Ord(Ch)+128);
End;
ScanKey := Ch;
End;
Begin
ClrScr;
{ Set up the mouse the way we want it }
SetMouseMotion(MoveAll); { All directions }
SetMouseButtons($3B00, {F1} { Refer to scancode table in Appendix C }
$3C00, {F2} { of Turbo Pascal Ref. manuals. }
$011B);{ESC}
SetMouseDelay(3,1); {Vertical & Horiz delays}
InitMouse(MouseLBReleased+MouseRBReleased+MouseMBReleased+MouseMoved);
{Left rel, Right rel, Mid rel, and Movement}
X := 40; Y := 13; { Initial Coordinates }
GoToXY(40-(Length(HelloStr) Div 2), 1);
Write(HelloStr);
GotoXY(40-(Length(ExitStr) Div 2), 25);
Write(ExitStr);
GoToXY(X,Y); { Place the cursor }
Repeat
Ch := ScanKey;
Case Ch of
#32..#127 : Write(Ch);
#187 : {F1} Write('F1');
#188 : {F2} Write('F2');
#189 : {F3} Write('F3');
#200 : {Up Cursor}
Begin
If Y = 1 then Y := 25 Else Dec(Y);
GoToXY(X,Y);
End;
#208 : {Down Cursor}
Begin
If Y = 25 Then Y := 1 Else Inc(Y);
GotoXY(X,Y);
End;
#203 : Begin { Left Key }
If X = 1 Then X := 80 Else Dec(X);
GotoXY(X,Y);
End;
#205 : Begin { Right Key }
If X = 80 Then X := 1 Else Inc(X);
GoToXY(X,Y);
End;
End; {Case}
Until Ch = #27;
End.